Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cb uri hostname for replicas using user role. #162

Merged
merged 1 commit into from
May 9, 2024

Conversation

abrightwell
Copy link
Member

It was reported that using cb uri to retrieve credentials for a user role on a replica was returning the hostname of the primary instead of the target replica.

This was because it's possible that the user role does not exist yet and therefore would need to first be created on the primary. So, to ensure that it is, we always attempt to create it on the primary and then retrieve it for the replica. Previously, we were only creating it and that was resulting in the returned credentials to be associated with the primary. So, we've now eliminated that branch in the code so that it will always retrieve this information from the correct target.

@abrightwell abrightwell requested a review from a team as a code owner May 8, 2024 19:24
It was reported that using `cb uri` to retrieve credentials for a `user`
role on a replica was returning the hostname of the `primary` instead of
the target replica.

This was because it's possible that the` user` role does not exist yet
and therefore would need to first be created on the primary. So, to
ensure that it is, we always attempt to create it on the primary and
then retrieve it for the replica. Previously, we were only creating it
and that was resulting in the returned credentials to be associated with
the primary. So, we've now eliminated that branch in the code so that it
will always retrieve this information from the correct target.
@abrightwell
Copy link
Member Author

Thanks!

@abrightwell abrightwell merged commit 704e6b2 into main May 9, 2024
2 checks passed
@abrightwell abrightwell deleted the abrightwell/fix-uri branch May 9, 2024 11:28
abrightwell added a commit that referenced this pull request May 9, 2024
It was reported in #158 that `cb psql` was having an issue with line
wrapping when text was entered beyond the bounds of the terminal window.
It turns out that this issue was related to characters in the prompt
being `Colorized`. And it was these bytes of the resulting string that
were causing the issue. So, we've simply removed the `Colorize` step
associated with this particular output. This does not impact the
coloring of the text in the prompt as that's part of the configured
`PROMPT1` in the resulting `.psqlrc`.

We've also take the opportunity here to update the uri fetching for the
`user` role which was missed as part of #162.
abrightwell added a commit that referenced this pull request May 9, 2024
It was reported in #158 that `cb psql` was having an issue with line
wrapping when text was entered beyond the bounds of the terminal window.
It turns out that this issue was related to characters in the prompt
being `Colorized`. And it was these bytes of the resulting string that
were causing the issue. So, we've simply removed the `Colorize` step
associated with this particular output. This does not impact the
coloring of the text in the prompt as that's part of the configured
`PROMPT1` in the resulting `.psqlrc`.

We've also take the opportunity here to update the uri fetching for the
`user` role which was missed as part of #162.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants